import { stringify } from 'qs';
import {request} from '../utils/request';
import { getConfig } from '../../config';
const config = getConfig();

// 计划信息列表--------------------------------------------------------------------
export async function queryPlanList(params) {
  return request('/maintain/maintainplan/list', {
    method: 'POST',
    body: params,
  });
}


// 增加计划
export async function actionPlanAdd(params) {
  return request('/maintain/maintainplan/save', {
    method: 'POST',
    body: params,
  });
}

// 编辑计划
export async function actionPlanEdit(params) {
  return request('/maintain/maintainplan/update', {
    method: 'POST',
    body: params,
  });
}

// 计划信息批量导出
export async function actionPlanExport(params) {
  return request(
    "04030004",
    {
      method: "POST",
      body: params
    },
    null,
    null,
    "download"
  );
}

// 计划信息批量中止
export async function actionPlanStop(params) {
  return request('/maintain/maintainplan/stopPlans', {
    method: 'POST',
    body: params,
  });
}



// 计划详情
export async function queryPlanInfo(params) {
  if (config.isMock) {
    return request(`/maintain/maintainplan/info`, {
      method: 'POST',
      body: params,
    });
  }else{
    return request(`/maintain/maintainplan/info/${params.planId}`, {
      method: 'POST',
    });
  }
}


// 计划相关设备
export async function queryDevForPlan(params) {
  return request('/maintain/maintainplan/queryPlanDevs', {
    method: 'POST',
    body: params,
  });
}


// 计划信息批量删除
export async function actionPlanDel(params) {
  return request('/maintain/maintainplan/delete', {
    method: 'POST',
    body: params,
  });
}
